-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement py-linter-formatter #1637
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comments added
app/main.py
Outdated
# write your code here | ||
pass | ||
return { | ||
"errors": ([format_linter_error(error) for error in errors]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a mistake, but you don't need to use additional braces ()
- list comprehension is good enough without them
app/main.py
Outdated
return { | ||
"errors": ([format_linter_error(error) for error in errors]), | ||
"path": file_path, | ||
"status": ("failed" if errors else "passed") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same with braces here
app/main.py
Outdated
return [format_single_linter_file(path, linter_report.get(path)) | ||
for path in linter_report] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this code is correct but a little bit complex to understand. I believe that using .items()
can make it more readable, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
app/main.py
Outdated
# write your code here | ||
pass | ||
return [ | ||
format_single_linter_file(*path) for path in linter_report.items() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it correct to name two items just a path
? Probably it. would be better to use 2 variables and give them correct name, where first would be really a path
maybe this name would be better? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gj!
pass | ||
return [ | ||
format_single_linter_file(*path_and_errors) | ||
for path_and_errors in linter_report.items() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be better to use two variables, smth like this:
for file, report in linter_report.items()
but ur solution is also ok
No description provided.